<?php

namespace App\Param;
use App\Exception\BusinessException;
use App\Exception\Handler\BusinessExceptionHandler;
use Hyperf\HttpServer\Contract\RequestInterface;
use function Swoole\Coroutine\Http\request;

/**
 * http 接口请求参数
 *
 * @author WangBin
 */
class HttpRequestParam
{
    public $service; // Service 类名
    public $method; // 方法名
    public $params; // 请求参数

    public static function create()
    {
        // 获取 Service
        $service = $request->input('service');
        if(empty($service)) {
            BusinessException::dispaly(500, "service 为空");
        }
        // 获取方法名
        $method = $request->input('method');
        if(empty($method)) {
            BusinessException::dispaly(500, "method 为空");
        }
    }

    /**
     * @return mixed
     */
    public function getService()
    {
        return $this->service;
    }

    /**
     * @param mixed $service
     */
    public function setService($service): void
    {
        $this->service = $service;
    }

    /**
     * @return mixed
     */
    public function getMethod()
    {
        return $this->method;
    }

    /**
     * @param mixed $method
     */
    public function setMethod($method): void
    {
        $this->method = $method;
    }

    /**
     * @return mixed
     */
    public function getParams()
    {
        return $this->params;
    }

    /**
     * @param mixed $params
     */
    public function setParams($params): void
    {
        $this->params = $params;
    }
}